@extends('template.adminpage')
@section('content')
 
<ol class="breadcrumb">
  <li class="active">Nota</li>
</ol>

<div class="container-black">
  <label style="margin-top:10px"><u>Pencarian</u></label>
  
	<form action="{{URL::to('/notas')}}" method="POST">
        <div class="input-group" >
           <label class="pull-left" style="margin-top:5px">Nama (Jenis) Nota </label>
           <input type="text" class="form-control pull-left" name="filter" style="width:250px;height:30px; margin-left:10px" value="{{Session::get('filter')}}">
           <span class="input-group-btn pull-left">
             <button class="btn btn-sm btn-dark" type="submit" style="width:100px;height:30px"><span class="fa fa-search"></span> Tampilkan</button>
           </span>
        </div><!-- /input-group -->
    </form>
    <br>
     <form action="{{URL::to('/nota/deletenota')}}"  method="post" >
    <p><a data-toggle="modal" data-target="#addnota"><button class="btn btn-sm btn-dark" style="height:30px" ><span class="fa fa-plus"></span> Tambah</button></a> <button class="btn btn-sm btn-dark" style="height:30px" type="submit" ><span class="fa  fa-times"></span> Hapus</button></p>
  	  <?php
        $limit = 10;
        if(Input::get('page')==0 OR Input::get('page')==1){ 
         $no = 1;
        }
        else{
         $no = ((Input::get('page')-1)*$limit)+1;
        } ?>
     <table class="table table-bordered table-hover">
      <thead>
        <tr>
          <th><input type="checkbox" name="checkall" id="terserah" onclick="check_all('terserah', {{$no}})" ></input></th>
          <th>No</th>
          <th>Nama (Jenis)</th>
          <th>Ply (Qty)</th>
          <th>Warna</th>
          <th>Kertas</th>
          <th>Ukuran</th>
          <th>Hasil</th>
          <th>Harga / Rim</th>
          <th>Aksi</th>
        </tr>
      </thead>
      <tbody>
      	
        @foreach($notatype as $type)
        <tr>
          <td><input type="checkbox" name="{{$type->bill_id}}" value="1" id="terserah_{{$no}}" ></input></td>
          <td>{{$no}}</td>
          <td>{{$type->bill_name}}</td>
          <td>{{$type->bill_qty_ply}}</td>
          <td>{{$type->bill_qty_color}}</td>
          <td>{{$type->papertype_name}}</td>
          <td>{{$type->bill_size}}</td>
          <td>{{$type->bill_size_to}}</td>
          <td>Rp {{number_format($type->bill_price,0,'.','.').' / '.$type->bill_qty_price.' '.$type->bill_qty_unit}}</td>
          <td><a data-toggle="modal" data-target="#{{$type->bill_id}}"><button class="btn btn-xs btn-dark"><span class="fa fa-edit"></span> Ubah</button></a></td>
        </tr>
        <?php $no++; ?>
        @endforeach
      </tbody>
    </table>
  </form>
    <div class="text-right"><?php echo $notatype->links(); ?></div>


        

               <div class="modal fade" id="addnota" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Tambah data nota  </label></h4>
                    </div>
                    <br>
                    <div align="left">
                              {{Form::open(array(
                                    'url' => '/nota/addnota',
                                    'method' => 'POST'
                                  ))}}
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-8 col-md-offset-1">

                                     
                                    <div class="row">
                                  <div class="col-lg-5">
                                  <label>Nama nota <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text" class="form-control" name="bill_name" style="width:200px;height:30px" placeholder="Nama" required></input>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Ply (Qty) <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                   <div class="row">
                                    <div class="col-lg-4">
                                      <input type="text" class="form-control" name="bill_qty_ply" style="width:75px;height:30px" placeholder="Qty"required ></input>
                                    </div>
                                    <div class="col-lg-4">
                                      Ply
                                    </div>
                                    </div>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Warna (Qty) <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                    <div class="row">
                                    <div class="col-lg-4">
                                      <input type="text" class="form-control" name="bill_qty_color" style="width:75px;height:30px" placeholder="Qty" required></input>
                                    </div>
                                    <div class="col-lg-4">
                                      Warna
                                    </div>
                                    </div>
                                  </div>
                                  </div>
                                  <br>
                                  
                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Kertas</label>
                                  </div>
                                  <div class="col-lg-4">
                                     <select  class="form-control" name="bill_papertype_id" style="width:200px;height:30px" >
                                      <?php
                                        $papers = DB::table('ref_papertype')
                                                      ->where('papertype_type','=','bill')
                                                      ->get();
                                      ?>
                                      @foreach($papers as $paper)
                                      <option value="{{$paper->papertype_id}}">{{$paper->papertype_name}}</option>
                                      @endforeach
                                    </select>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                  <div class="col-lg-5">
                                  <label>Ukuran</label>
                                  </div>
                                  <div class="col-lg-4">
                                     <select  class="form-control" name="bill_size" style="width:200px;height:30px" >
                                      <option value="A4">A4</option>
                                      <option value="A5">A5</option>
                                    </select>
                                    </select>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Harga <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                    <input type="text"  class="form-control"  name="bill_price" placeholder="Harga"style="width:200px;height:30px" value="" required /></input>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                    <div class="col-lg-5">
                                      <label>Qty / Unit <font color="red"> *</font></label>
                                    </div>
                                    <div class="col-lg-3">
                                     <input type="text"  class="form-control"  name="bill_qty_price" placeholder="Qty" style="width:90px;height:30px" value="" required/></input>
                                    </div>
                                    <div class="col-lg-1">
                                     /
                                    </div>
                                    
                                    <div class="col-lg-3">
                                      <select  class="form-control"  name="bill_qty_unit" style="width:80px;height:30px">
                                        <option value="Rim">Rim</option>
                                        <option value="Lembar">Lembar</option>
                                      </select>
                                    </div>
                                    </div>
                                    <br>
                                      <font color="red" class="text-left">* Data tidak boleh kosong</font>

                              </div>
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>

              @foreach($notatype as $type)
              <div class="modal fade" id="{{$type->bill_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Ubah data nota  </label></h4>
                    </div>
                    <div align="left">
                              {{Form::open(array(
                                    'url' => '/nota/editnota/'.$type->bill_id,
                                    'method' => 'POST'
                                  ))}}
                               <div class="row" style="margin-top:10px">
                              <div class="col-md-8 col-md-offset-1">

                                     
                                    <div class="row">
                                  <div class="col-lg-5">
                                  <label>Nama nota <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text" class="form-control" name="bill_name" style="width:200px;height:30px" placeholder="Nama" value="{{$type->bill_name}}" required></input>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Ply (Qty) <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                   <div class="row">
                                    <div class="col-lg-4">
                                      <input type="text" class="form-control" name="bill_qty_ply" style="width:75px;height:30px" placeholder="Qty"required value="{{$type->bill_qty_ply}}" ></input>
                                    </div>
                                    <div class="col-lg-4">
                                      Ply
                                    </div>
                                    </div>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Warna (Qty) <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                    <div class="row">
                                    <div class="col-lg-4">
                                      <input type="text" class="form-control" name="bill_qty_color" style="width:75px;height:30px" placeholder="Qty" value="{{$type->bill_qty_color}}" required></input>
                                    </div>
                                    <div class="col-lg-4">
                                      Warna
                                    </div>
                                    </div>
                                  </div>
                                  </div>
                                  <br>
                                  
                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Kertas</label>
                                  </div>
                                  <div class="col-lg-4">
                                     <select  class="form-control" name="bill_papertype_id" style="width:200px;height:30px" >
                                       <?php
                                        $papers = DB::table('ref_papertype')
                                                      ->where('papertype_type','=','bill')
                                                      ->get();
                                      foreach($papers as $paper){
                                       if($type->bill_papertype_id==$paper->papertype_id){
                                      echo '<option value="'.$paper->papertype_id.'" selected>'.$paper->papertype_name.'</option>';
                                      }else{
                                      echo '<option value="'.$paper->papertype_id.'">'.$paper->papertype_name.'</option>';

                                      }
                                      }
                                     ?>
                                    </select>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                  <div class="col-lg-5">
                                  <label>Ukuran</label>
                                  </div>
                                  <div class="col-lg-4">
                                     <select  class="form-control" name="bill_size" style="width:200px;height:30px" >
                                        <?php
                                        $brosursizes = array('A4'); //a5 ada
                                      foreach($brosursizes as $key){
                                        if($type->bill_size==$key){
                                      echo '<option value="'.$key.'" selected>'.$key.'</option>';
                                      }else{
                                      echo '<option value="'.$key.'">'.$key.'</option>';

                                      }
                                      }
                                      ?>
                                    </select>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-5">
                                  <label>Harga <font color="red"> *</font></label>
                                  </div>
                                  <div class="col-lg-7">
                                    <input type="text"  class="form-control"  name="bill_price" placeholder="Harga"style="width:200px;height:30px" value="{{$type->bill_price}}" required /></input>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                    <div class="col-lg-5">
                                      <label>Qty / Unit <font color="red"> *</font></label>
                                    </div>
                                    <div class="col-lg-3">
                                     <input type="text"  class="form-control"  name="bill_qty_price"  style="width:90px;height:30px" value="{{$type->bill_qty_price}}" required/></input>
                                    </div>
                                    <div class="col-lg-1">
                                     /
                                    </div>
                                    
                                    <div class="col-lg-3">
                                      <select  class="form-control"  name="bill_qty_unit" style="width:80px;height:30px">
                                         <?php
                                        $brosursizes = array('Rim','Lembar');
                                      foreach($brosursizes as $key){
                                        if($type->bill_qty_unit==$key){
                                      echo '<option value="'.$key.'" selected>'.$key.'</option>';
                                      }else{
                                      echo '<option value="'.$key.'">'.$key.'</option>';

                                      }
                                      }
                                      ?>
                                      </select>
                                    </div>
                                    </div>
                                    <br>
                                      <font color="red" class="text-left">* Data tidak boleh kosong</font>

                              </div>
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach

</div>


@stop
@stop